package com.koron.order.application.service;


import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.koron.bean.query.PageQuery;
import com.koron.order.application.bean.dto.ApplicationDTO;
import com.koron.order.application.bean.po.ApplicationEquipment;
import org.koron.ebs.mybatis.SessionFactory;

import java.util.List;

/**
 * 检修申请-设备信息从表(ApplicationEquipment)表服务接口
 *
 * @author jzp
 * @since 2021-11-02 09:34:34
 */
public interface ApplicationEquipmentService {

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    ApplicationEquipment getById(SessionFactory factory, String id);

    /**
     * 查询所有数据
     *
     * @param applicationEquipment 查询条件对象
     * @return 列表结果集
     */
    List<ApplicationEquipment> list(SessionFactory factory, ApplicationEquipment applicationEquipment);

    List<ApplicationEquipment> listByAppIds(SessionFactory factory, List<String> appIds);

    /**
     * 分页查询
     * applicationEquipment 分页对象
     *
     * @return 对象列表
     */
    default PageInfo<ApplicationEquipment> page(SessionFactory factory, PageQuery pageQuery, ApplicationEquipment applicationEquipment) {
        PageHelper.startPage(pageQuery.getPage(), pageQuery.getPageSize(), pageQuery.getOrderBy());
        List<ApplicationEquipment> applicationEquipmentList = list(factory, applicationEquipment);
        return new PageInfo<>(applicationEquipmentList);
    }

    /**
     * 新增数据
     *
     * @param applicationEquipment 实例对象
     * @return 是否成功
     */
    boolean save(SessionFactory factory, ApplicationEquipment applicationEquipment);

    /**
     * 批量新增数据
     *
     * @param applicationEquipments 实例对象
     * @return 是否成功
     */
    boolean saveBatch(SessionFactory factory, List<ApplicationEquipment> applicationEquipments);

    /**
     * 修改数据
     *
     * @param applicationEquipment 实例对象
     * @return 是否成功
     */
    boolean update(SessionFactory factory, ApplicationEquipment applicationEquipment);

    /**
     * 通过主键删除数据
     *
     * @param ids 主键集合
     * @return 是否成功
     */
    boolean deleteBatchIds(SessionFactory factory, List<String> ids);

    boolean removeByApplicationId(SessionFactory factory, String applicationId);

    void updateStatus(SessionFactory factory, ApplicationDTO applicationDTO);

}
